@model TemplateIndexViewModel

<h1>@RenderTitleSegments(T["Templates"])</h1>

<nav class="admin-toolbar">
    <ul class="navbar-nav mr-auto">
        <li class="nav-item">
            <a asp-route-action="Create" class="btn btn-primary" role="button">@T["Add Template"]</a>
        </li>
    </ul>
</nav>

<form asp-action="Index"> @* the form is necessary to generate and antiforgery token for the delete action *@

    @if (Model.Templates.Any())
    {
        <ul class="list-group">
            @foreach (var entry in Model.Templates)
            {
                <li class="list-group-item">
                    <div class="properties">
                        <div class="related">
                            <a asp-action="Edit" asp-route-name="@entry.Name" class="btn btn-primary btn-sm">@T["Edit"]</a>
                            <a asp-action="Delete" asp-route-name="@entry.Name" class="btn btn-danger btn-sm" itemprop="RemoveUrl UnsafeUrl">@T["Delete"]</a>
                        </div>
                        <a asp-action="Edit" asp-route-name="@entry.Name">@entry.Name</a>
                        @if (!String.IsNullOrWhiteSpace(entry.Template.Description))
                        {
                        <span class="hint">
                            @T["— {0}", entry.Template.Description]
                        </span>
                        }
                    </div>
                </li>
            }
        </ul>
    }
    else
    {
        <div class="alert alert-info" role="alert">
            @T["<strong>Nothing here!</strong> There are no templates for the moment."]
        </div>
    }
</form>

@await DisplayAsync(Model.Pager)
